﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace XmlVisualizer.Dialogs {
	/// <summary>
	/// Interaction logic for DialogDeleteRecursively.xaml
	/// </summary>
	public partial class DialogDeleteRecursively : Window {
		#region Fields
		private MessageBoxResult returnValue;
		bool posAdjusted = false;
		#endregion

		#region Constructors
		public DialogDeleteRecursively() {
			InitializeComponent();
		}
		#endregion

		#region Methods
		/// <summary>
		/// Displays and shows the window until user closes it.
		/// </summary>
		/// <returns><see cref="DialogAddElementAttribute.IDOK">IDOK</see> on successful closure,
		/// <see cref="DialogAddElementAttribute.IDCANCEL">IDCANCEL</see> otherwise.</returns>
		public MessageBoxResult ShowModal() {
			returnValue = MessageBoxResult.Cancel;
			ShowDialog();
			return returnValue;
		}
		#endregion

		#region Event handlers
		/// <summary>
		/// Invoked when window gets activated.
		/// </summary>
		/// <param name="e">The event data.</param>
		protected override void OnActivated(EventArgs e) {
			base.OnActivated(e);
			if (!posAdjusted) {
				this.Left -= this.ActualWidth;
				this.Top -= this.ActualHeight;
				posAdjusted = true;
			}
		}

		private void btn_Yes_Click(object sender, RoutedEventArgs e) {
			returnValue = MessageBoxResult.Yes;
			Close();
		}

		private void btn_No_Click(object sender, RoutedEventArgs e) {
			returnValue = MessageBoxResult.No;
			Close();
		}

		private void btn_Cancel_Click(object sender, RoutedEventArgs e) {
			returnValue = MessageBoxResult.Cancel;
			Close();
		}
		#endregion		
	}
}
